package com.wangzaiplus.test.proxy;

import java.lang.reflect.Proxy;

/**
 * @ClassName Main
 * @Description: TODO
 * @Author wgc
 * @Date 2020/04/16 18:24
 * @Version V1.0
 **/
public class Main {
    public static PersonBean  getOwnerProxy(PersonBean personBean){
       return  (PersonBean)Proxy.newProxyInstance(personBean.getClass().getClassLoader(),personBean.getClass().getInterfaces(),new OwnerInvocationHandler(personBean));
    }
    public static void main(String[] args) throws Exception{
        PersonBean person = new Person("Bob", 24, 90);
        PersonBean ownerProxy = getOwnerProxy(person);
        ownerProxy.setHotOrNotRating(10);
    }
}
